<template>
  <ant-modal modalWidth="576" modalHeight="500" :visible="open" :modal-title="formTitle" :adjust-size="true" @cancel="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="24">
          <a-form-model-item label="地区名称" prop="name">
            <a-input v-model="form.name" placeholder="请输入地区名称" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="地区简称" prop="abbreviation">
            <a-input v-model="form.abbreviation" placeholder="请输入地区简称" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="地区编码" prop="code">
            <a-input v-model="form.code" placeholder="请输入地区编码" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="地区类型" prop="type">
            <a-select
              placeholder="请选择地区类型"
              v-model="form.type"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear
            >
              <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="地区省份" prop="province">
            <select-area type="select" :level="0" v-model="form.province" placeholder="请选择地区省份" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="运营者" prop="userId">
            <select-user v-model="form.userId" select-model="single" placeholder="请选择运营者" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="关联部门" prop="departId">
            <select-dept v-model="form.departId" select-model="single" select-scope="all" placeholder="请选择关联部门" />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="私有类型" prop="isPrivate">
            <a-select
              placeholder="请选择私有类型"
              v-model="form.isPrivate"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear
            >
              <a-select-option v-for="(d, index) in isPrivateOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="地区头像" prop="avatar">
            <image-upload v-model="form.avatar" isMultiple :number="1" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="朋友圈二维码" prop="momentImage">
            <image-upload v-model="form.momentImage" isMultiple :number="1" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="公众号二维码" prop="officialAccountImage">
            <image-upload v-model="form.officialAccountImage" isMultiple :number="1" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="收款码" prop="receiveMoneyImage">
            <image-upload v-model="form.receiveMoneyImage" isMultiple :number="1" />
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel"> 取消 </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)"> 保存 </a-button>
    </template>
  </ant-modal>
</template>
<script>
import RegionAddForm from './RegionForm'
export default {
  ...RegionAddForm
}
</script>

